<template>
  <div>
    <!-- ------------------------------------------------------------------柜台账户期初数据导入---------------------------------------------------------------- -->
    <el-card shadow="never" class="d2-mb titleline">
      <template slot="header" style="height:66px;">
        <span class="title_x el-button--primary fl"></span>
        <p class="title_l fl">柜台账户期初数据导入</p>
      </template>
       <div class="mb">
          <!-- <div class="d2-mb">
            <el-upload :before-upload="handleUpload" action="default">
              <el-button type="success">
                <d2-icon name="file-o"/>
                选择要导入的 .xlsx 表格
              </el-button>
            </el-upload>
          </div> -->
          <el-upload
            class="upload-btn"
            :action="uploadUrl"
            accept=".xls, .xlsx"
            :on-success="handleAvatarSuccess"
            :on-progress="uploadProgress"
            :on-error="handleUploadError"
            :show-file-list="false" style="display:inline-block;margin-right:10px;">
          <el-button type="default" size="small">
            <d2-icon name="download" />
            导入
          </el-button>
          </el-upload>
          
          <el-button type="default" size="small" @click="handleFormSubmit">
            <d2-icon name="upload" />
            导出
          </el-button>
          <el-button
            type="default"
            size="small"
            @click="RefreshCurrent_all">
            <d2-icon name="refresh" />
            刷新
          </el-button>
       </div>
      <p>柜台账户资金信息</p>
      <el-table :data="drcaptableData" border style="width: 100%" 
      :cell-style="{'text-align':'center'}" 
      :header-cell-style="{ background: '#eef1f6','text-align':'center'}" highlight-current-row>
        <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期" sortable>
        </el-table-column>
        <el-table-column prop="prebalance" label="期初结存">
        </el-table-column>
        <el-table-column prop="deposit_withdraw" label="出入金">
        </el-table-column>
        <el-table-column prop="closeprofit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="positionprofit" label="持仓盯市盈亏">
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
        <el-table-column prop="balance" label="期末结存">
        </el-table-column>
        <el-table-column prop="currmargin" label="保证金占用">
        </el-table-column>
         <el-table-column prop="deliverymargin" label="交割保证金">
        </el-table-column>
        <el-table-column prop="available" label="可用资金">
        </el-table-column>
         <el-table-column prop="exercise_fee" label="风险度">
        </el-table-column>
      </el-table>
       <el-pagination
      @size-change="handleSizeChange1"
      @current-change="handleCurrentChange1"
      background
      :current-page="capForm.currentPage"
      :page-size="capForm.pageSize"
      layout="total, prev, pager, next"
      :total="capForm.totalPage"
    >
      </el-pagination>
       <p>柜台账户成交记录</p>
      <el-table :data="drtradedableData" border style="width: 100%" 
      :cell-style="{'text-align':'center'}" 
      :header-cell-style="{ background: '#eef1f6','text-align':'center'}" highlight-current-row>
       <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期" sortable>
        </el-table-column>
         <el-table-column prop="tradedate" label="成交日期" sortable>
        </el-table-column>
         <el-table-column prop="tradetime" label="成交时间">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="direction" label="方向">
        </el-table-column>
        <el-table-column prop="offsetflag" label="开/平" >
        </el-table-column>
        <el-table-column prop="volume" label="手数">
        </el-table-column>
        <el-table-column prop="price" label="成交价">
        </el-table-column>
        <el-table-column prop="hedgeflag" label="投/保" >
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
        <el-table-column prop="close_profit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="tradeid" label="成交序号">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange2"
      @current-change="handleCurrentChange2"
      background
      :current-page="tradedForm.currentPage"
      :page-size="tradedForm.pageSize"
      layout="total, prev, pager, next"
      :total="tradedForm.totalPage"
    >
    </el-pagination>
     <p>柜台账户持仓明细</p>
      <el-table :data="drpostableData" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row @selection-change="handleSelectionChange">
         <el-table-column label="序号" type="index" width="55">
        </el-table-column>
         <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="opendate" label="开仓日期">
        </el-table-column>
        <el-table-column prop="tradeid" label="成交序号">
        </el-table-column>
        <el-table-column prop="direction" label="方向">
        </el-table-column>
        <el-table-column prop="volume" label="持仓量">
        </el-table-column>
        <el-table-column prop="openprice" label="开仓价">
        </el-table-column>
         <el-table-column prop="hedgeflag" label="投/保">
        </el-table-column>
        <el-table-column prop="margin" label="保证金">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange3"
      @current-change="handleCurrentChange3"
      background
      :current-page="posForm.currentPage"
      :page-size="posForm.pageSize"
      layout="total, prev, pager, next"
      :total="posForm.totalPage"
    >
    </el-pagination>
    <el-button type="primary" @click="dr_all" style="margin-top:20px;width:120px;">上传数据</el-button>
    </el-card>
   <!-- ---------------------------------------------------------柜台账户资金管理---------------------------------------------- -->
    <el-card shadow="never" class="d2-mb titleline">
      <template slot="header" style="height:66px;">
        <span class="title_x el-button--primary fl"></span>
        <p class="title_l fl">柜台账户资金管理</p>
      </template>
      <el-card shadow="never" class="d2-mb">
        <el-form class="filter-container"
        ref="capForm"
        :model="capForm"
        label-width="100px">
           <el-row :gutter="20">
           <el-col :span="8">
                 <el-form-item label="交易日期">
                <el-col :span="11">
                  <el-date-picker type="date" v-model="capForm.start_date" :picker-options="cappickerOptionsStart" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
                <el-col class="line tc" :span="2">~</el-col>
                <el-col :span="11">
                  <el-date-picker type="date" v-model="capForm.end_date" :picker-options="cappickerOptionsEnd" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>
           <el-col :span="4">
           <el-form-item label="柜台账号">
            <el-input v-model="capForm.realaccountcode"></el-input>
          </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="经纪商ID">
            <el-input v-model="capForm.brokerid"></el-input>
          </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="数据来源">
            <el-select
                v-model="capForm.trade_source"
                clearable
                class="filter-item"
                placeholder="请选择"
              >
                <el-option label="人工录入" value="0"></el-option>
                <el-option label="系统导入" value="1"></el-option>
              </el-select>
          </el-form-item>
          </el-col>
           <el-col :span="4">
          <el-form-item>
            <el-button size="mini" type="primary" @click="handle_realaccouncap">查询</el-button>
          </el-form-item>
          </el-col>
          </el-row>
        </el-form>
      </el-card>
       <div class="mb">
      <el-button type="default" size="small" @click="add_cap">
        <d2-icon name="plus" />
        新增
      </el-button>
      <el-button type="default" size="small" @click="edit_cap" v-if="this.capForm.trade_source == '0'">
        <d2-icon name="edit" />
        修改
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="del_cap" v-if="this.capForm.trade_source == '0'">
        删除
      </el-button>
      <el-button type="default" size="small" @click="copy_cap" v-if="this.capForm.trade_source == '0'">
         <i class="fa fa-clipboard" aria-hidden="true"></i>
         复制
      </el-button>
       <!-- <el-button type="default" size="small" @click="read_cap">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          读取成交
        </el-button> -->
       <el-upload
            class="upload-btn"
            :action="uploadUrl"
            accept=".xls, .xlsx"
            :on-success="handleAvatarSuccesscap"
            :on-progress="uploadProgress"
            :on-error="handleUploadError"
            :show-file-list="false" style="display:inline-block;margin:0 10px;">
          <el-button type="default" size="small">
            <d2-icon name="download" />
            导入
          </el-button>
          </el-upload>
      <el-button type="default" size="small" @click="handleFormSubmit">
        <d2-icon name="upload" />
        导出
      </el-button>
      <el-button
        type="default"
        size="small"
        @click="RefreshCurrent_cap"
      >
        <d2-icon name="refresh" />
        刷新
      </el-button>
       <el-button type="default" size="small" @click="tz_cap" v-if="this.capForm.trade_source == '0'">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          调整
        </el-button>
       </div>
      <p>柜台账户资金</p>
      <el-table :data="captableData" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="adjust_status" label="是否调整" :formatter="formatterStatus">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="prebalance" label="期初结存">
        </el-table-column>
        <el-table-column prop="deposit_withdraw" label="出入金">
        </el-table-column>
        <el-table-column prop="closeprofit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="positionprofit" label="持仓盯市盈亏">
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
         <el-table-column prop="deliveryfee" label="交割手续费">
        </el-table-column>
        <el-table-column prop="balance" label="期末结存">
        </el-table-column>
         <el-table-column prop="exercise_fee" label="行政手续费">
        </el-table-column>
        <el-table-column prop="clientequity" label="客户权益">
        </el-table-column>
        <el-table-column prop="currmargin" label="保证金占用">
        </el-table-column>
         <el-table-column prop="deliverymargin" label="交割保证金">
        </el-table-column>
        <el-table-column prop="available" label="可用资金">
        </el-table-column>
        <el-table-column prop="exercise_fee" label="风险度">
        </el-table-column>
        <el-table-column prop="margincall" label="应追加保证金">
        </el-table-column>
        <el-table-column prop="trade_source" label="数据来源" :formatter="formatterSource">
        </el-table-column>
      </el-table>
       <el-pagination
      @size-change="handleSizeChange1"
      @current-change="handleCurrentChange1"
      background
      :current-page="capForm.currentPage"
      :page-size="capForm.pageSize"
      layout="total, prev, pager, next"
      :total="capForm.totalPage"
    >
    </el-pagination>
    </el-card>
    <!-- ---------------------------------------------------------柜台账户成交管理---------------------------------------------- -->
    <el-card shadow="never" class="d2-mb titleline">
      <template slot="header" style="height:66px;">
        <span class="title_x el-button--primary fl"></span>
        <p class="title_l fl">柜台账户成交管理</p>
      </template>
      <el-card shadow="never" class="d2-mb">
        <el-form class="filter-container"
        ref="tradedForm"
        :model="tradedForm"
        label-width="100px">
           <el-row :gutter="20">
           <el-col :span="8">
                 <el-form-item label="交易日期">
                <el-col :span="11">
                  <el-date-picker type="date" v-model="tradedForm.start_date" :picker-options="tradedpickerOptionsStart" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
                <el-col class="line tc" :span="2">~</el-col>
                <el-col :span="11">
                  <el-date-picker type="date" v-model="tradedForm.end_date" :picker-options="tradedpickerOptionsEnd" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>
           <el-col :span="4">
           <el-form-item label="柜台账号">
            <el-input v-model="tradedForm.realaccountcode"></el-input>
          </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="合约">
              <el-input v-model="tradedForm.instrumentid"></el-input>
            </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="开/平">
              <el-select  clearable v-model="tradedForm.offsetflag" placeholder="请选择" filterable allow-create>
			             <el-option label="开仓" value="0"></el-option>
                   <el-option label="平仓" value="1"></el-option>
                   <el-option label="开今仓" value="3"></el-option>
                   <el-option label="平昨仓" value="4"></el-option>
			         </el-select>
          </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="成交序号">
            <el-input v-model="tradedForm.tradeid"></el-input>
          </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="数据来源">
            <el-select
                v-model="tradedForm.trade_source"
                clearable
                class="filter-item"
                placeholder="请选择"
              >
                <el-option label="人工录入" value="0"></el-option>
                <el-option label="系统导入" value="1"></el-option>
              </el-select>
          </el-form-item>
          </el-col>
           <el-col :span="4">
          <el-form-item>
            <el-button size="mini" type="primary" @click="handle_realtraded">查询</el-button>
          </el-form-item>
          </el-col>
          </el-row>
        </el-form>
      </el-card>
       <div class="mb">
      <el-button type="default" size="small" @click="add_traded">
        <d2-icon name="plus" />
        新增
      </el-button>
      <el-button type="default" size="small" @click="edit_traded" v-if="this.tradedForm.trade_source == '0'">
        <d2-icon name="edit" />
        修改
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="del_traded" v-if="this.tradedForm.trade_source == '0'">
        删除
      </el-button>
      <el-button type="default" size="small" @click="copy_traded" v-if="this.tradedForm.trade_source == '0'">
         <i class="fa fa-clipboard" aria-hidden="true"></i>
         复制
      </el-button>
       <!-- <el-button type="default" size="small" @click="read_cap">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          读取成交
        </el-button> -->
       <el-upload
            class="upload-btn"
            :action="uploadUrl"
            accept=".xls, .xlsx"
            :on-success="handleAvatarSuccesstraded"
            :on-progress="uploadProgress"
            :on-error="handleUploadError"
            :show-file-list="false" style="display:inline-block;margin:0 10px;">
          <el-button type="default" size="small">
            <d2-icon name="download" />
            导入
          </el-button>
          </el-upload>
      <el-button type="default" size="small" @click="handleFormSubmit">
        <d2-icon name="upload" />
        导出
      </el-button>
      <el-button
        type="default"
        size="small"
        @click="RefreshCurrent_traded"
      >
        <d2-icon name="refresh" />
        刷新
      </el-button>
       <el-button type="default" size="small" @click="tz_traded" v-if="this.tradedForm.trade_source == '0'">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          调整
        </el-button>
       </div>
      <p>柜台账户成交</p>
      <el-table :data="tradedableData" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55">
        </el-table-column>
         <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="adjust_status" label="是否调整" :formatter="formatterStatus">
        </el-table-column>
        <el-table-column prop="exchangename" label="交易所">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
        <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="tradedate" label="成交日期">
        </el-table-column>
         <el-table-column prop="tradetime" label="成交时间">
        </el-table-column>
        <el-table-column prop="productname" label="品种">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="direction" label="方向">
        </el-table-column>
        <el-table-column prop="offsetflag" label="开/平">
        </el-table-column>
        <el-table-column prop="price" label="成交价">
        </el-table-column>
        <el-table-column prop="volume" label="手数">
        </el-table-column>
        <el-table-column prop="amount" label="成交额">
        </el-table-column>
        <el-table-column prop="hedgeflag" label="投/保">
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
        <el-table-column prop="close_profit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="tradeid" label="成交序号">
        </el-table-column>
        <el-table-column prop="trade_source" label="数据来源">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange2"
      @current-change="handleCurrentChange2"
      background
      :current-page="tradedForm.currentPage"
      :page-size="tradedForm.pageSize"
      layout="total, prev, pager, next"
      :total="tradedForm.totalPage"
    >
    </el-pagination>
    </el-card>
     <!-- ---------------------------------------------------------柜台账户持仓明细---------------------------------------------- -->
    <el-card shadow="never" class="d2-mb titleline">
      <template slot="header" style="height:66px;">
        <span class="title_x el-button--primary fl"></span>
        <p class="title_l fl">柜台账户持仓明细</p>
      </template>
      <el-card shadow="never" class="d2-mb">
        <el-form class="filter-container"
        ref="posForm"
        :model="posForm"
        label-width="100px">
           <el-row :gutter="20">
           <el-col :span="8">
                 <el-form-item label="交易日期">
                <el-col :span="11">
                  <el-date-picker type="date" v-model="posForm.start_date" :picker-options="pospickerOptionsStart" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
                <el-col class="line tc" :span="2">~</el-col>
                <el-col :span="11">
                  <el-date-picker type="date" v-model="posForm.end_date" :picker-options="pospickerOptionsEnd" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>
           <el-col :span="4">
           <el-form-item label="柜台账号">
            <el-input v-model="posForm.realaccountcode"></el-input>
          </el-form-item>
          </el-col>
           <!-- <el-col :span="4">
            <el-form-item label="品种">
              <el-select
                v-model="posForm.productid"
                placeholder="请选择"
                style="width:100%;" @change="handle_instrument1"
              >
                <el-option
                  v-for="item in productidList"
                  :key="item.productid"
                  :label="item.ProductName"
                  :value="item.productid"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
           <el-col :span="4">
            <el-form-item label="合约">
              <el-input v-model="posForm.instrumentid"></el-input>
            </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="经纪商ID">
            <el-input v-model="posForm.brokerid"></el-input>
          </el-form-item>
          </el-col>
           <el-col :span="4">
           <el-form-item label="数据来源">
            <el-select
                v-model="posForm.trade_source"
                clearable
                class="filter-item"
                placeholder="请选择"
              >
                <el-option label="人工录入" value="0"></el-option>
                <el-option label="系统导入" value="1"></el-option>
              </el-select>
          </el-form-item>
          </el-col>
           <el-col :span="4">
          <el-form-item>
            <el-button size="mini" type="primary" @click="futures_getData">查询</el-button>
          </el-form-item>
          </el-col>
          </el-row>
        </el-form>
      </el-card>
        <div class="mb">
      <el-button type="default" size="small" @click="add_pos">
        <d2-icon name="plus" />
        新增
      </el-button>
      <el-button type="default" size="small" @click="edit_pos" v-if="this.posForm.trade_source == '0'">
        <d2-icon name="edit" />
        修改
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="del_pos" v-if="this.posForm.trade_source == '0'">
        删除
      </el-button>
      <el-button type="default" size="small" @click="copy_pos" v-if="this.posForm.trade_source == '0'">
         <i class="fa fa-clipboard" aria-hidden="true"></i>
         复制
      </el-button>
       <!-- <el-button type="default" size="small" @click="read_cap">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          读取成交
        </el-button> -->
       <el-upload
            class="upload-btn"
            :action="uploadUrl"
            accept=".xls, .xlsx"
            :on-success="handleAvatarSuccesspos"
            :on-progress="uploadProgress"
            :on-error="handleUploadError"
            :show-file-list="false" style="display:inline-block;margin:0 10px;">
          <el-button type="default" size="small">
            <d2-icon name="download" />
            导入
          </el-button>
          </el-upload>
      <el-button type="default" size="small" @click="handleFormSubmit">
        <d2-icon name="upload" />
        导出
      </el-button>
      <el-button
        type="default"
        size="small"
        @click="RefreshCurrent_pos"
      >
        <d2-icon name="refresh" />
        刷新
      </el-button>
       <el-button type="default" size="small" @click="tz_pos" v-if="this.posForm.trade_source == '0'">
          <i class="fa fa-gavel" aria-hidden="true"></i>
          调整
        </el-button>
       </div>
      <p>持仓明细</p>
      <el-table :data="postableData" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column label="序号" type="index" width="55">
        </el-table-column>
         <el-table-column prop="adjust_status" label="是否调整" :formatter="formatterStatus">
        </el-table-column>
         <el-table-column prop="exchangename" label="交易所">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
         <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
        <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="productname" label="品种">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="opendate" label="开仓日期">
        </el-table-column>
        <el-table-column prop="directionname" label="方向">
        </el-table-column>
        <el-table-column prop="hedgeflagname" label="投/保">
        </el-table-column>
        <el-table-column prop="volume" label="持仓量">
        </el-table-column>
        <el-table-column prop="openprice" label="开仓价">
        </el-table-column>
        <el-table-column prop="lastsettlementprice" label="昨结算">
        </el-table-column>
        <el-table-column prop="settlementprice" label="结算价">
        </el-table-column>
        <el-table-column prop="float_profit_loss" label="浮动盈亏">
        </el-table-column>
        <el-table-column prop="mark_profit_loss" label="盯市盈亏">
        </el-table-column>
        <el-table-column prop="margin" label="保证金">
        </el-table-column>
        <el-table-column prop="trade_source" label="数据来源">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange3"
      @current-change="handleCurrentChange3"
      background
      :current-page="posForm.currentPage"
      :page-size="posForm.pageSize"
      layout="total, prev, pager, next"
      :total="posForm.totalPage"
    >
    </el-pagination>
    </el-card>

    <!-- 新增资金 -->
    <el-dialog title="新增资金" :visible.sync="capdialogVisible" width="90%">
        <div>
    <div class="mb">
      <el-button type="default" size="small" @click="addRow1">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData1">
        删行
      </el-button>
    </div>
     <el-form label-position="right" status-icon :rules="rules" :model="add_capData" ref="ruleForm1">
    <el-table :data="add_capData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
      <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期初结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.prebalance'" :rules="rules.prebalance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.prebalance"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="出入金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deposit_withdraw'" :rules="rules.deposit_withdraw">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deposit_withdraw"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.closeprofit'" :rules="rules.closeprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.closeprofit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="持仓盯市盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.positionprofit'" :rules="rules.positionprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.positionprofit"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期末结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.balance'" :rules="rules.balance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.balance"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.currmargin'" :rules="rules.currmargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.currmargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交割保证金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deliverymargin'" :rules="rules.deliverymargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deliverymargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="可用资金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.available'" :rules="rules.available">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.available"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="风险度" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.exercise_fee'" :rules="rules.exercise_fee">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.exercise_fee"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="capdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" size="small" @click="change_addcap('ruleForm1')">保存</el-button>
      </span>
    </el-dialog>
    <!-- 修改资金 -->
    <el-dialog title="修改资金" :visible.sync="editcapdialogVisible" width="90%">
        <div>
    <!-- <div class="mb">
      <el-button type="default" size="small" @click="addRow1">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData1">
        删行
      </el-button>
    </div> -->
     <el-form label-position="right" status-icon :rules="rules" :model="edit_capData" ref="ruleForm1">
    <el-table :data="edit_capData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
      <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期初结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.prebalance'" :rules="rules.prebalance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.prebalance"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="出入金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deposit_withdraw'" :rules="rules.deposit_withdraw">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deposit_withdraw"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.closeprofit'" :rules="rules.closeprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.closeprofit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="持仓盯市盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.positionprofit'" :rules="rules.positionprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.positionprofit"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期末结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.balance'" :rules="rules.balance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.balance"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.currmargin'" :rules="rules.currmargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.currmargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交割保证金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deliverymargin'" :rules="rules.deliverymargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deliverymargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="可用资金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.available'" :rules="rules.available">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.available"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="风险度" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.exercise_fee'" :rules="rules.exercise_fee">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.exercise_fee"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="editcapdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_editcap('ruleForm1')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 资金复制 -->
    <el-dialog title="复制资金" :visible.sync="copycapdialogVisible" width="90%">
        <div>
           <div class="mb">
      <el-button type="default" size="small" @click="addRow1_copy">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData1_copy">
        删行
      </el-button>
    </div>
     <el-form label-position="right" status-icon :rules="rules" :model="copy_capData" ref="ruleForm1">
    <el-table :data="copy_capData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
        <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期初结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.prebalance'" :rules="rules.prebalance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.prebalance"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="出入金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deposit_withdraw'" :rules="rules.deposit_withdraw">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deposit_withdraw"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.closeprofit'" :rules="rules.closeprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.closeprofit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="持仓盯市盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.positionprofit'" :rules="rules.positionprofit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.positionprofit"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期末结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.balance'" :rules="rules.balance">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.balance"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.currmargin'" :rules="rules.currmargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.currmargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交割保证金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deliverymargin'" :rules="rules.deliverymargin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.deliverymargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="可用资金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.available'" :rules="rules.available">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.available"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="风险度" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.exercise_fee'" :rules="rules.exercise_fee">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.exercise_fee"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="copycapdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_copycap('ruleForm1')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 资金调整 -->
     <el-dialog title="调整资金" :visible.sync="tzcapdialogVisible" width="90%">
        <div>
           <el-form label-position="right" status-icon :rules="rules" :model="tz_capData" ref="ruleForm1">
    <el-table :data="tz_capData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
       <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" :disabled="scope.$index == '0'" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期初结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.prebalance'" :rules="rules.prebalance">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.prebalance"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="出入金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deposit_withdraw'" :rules="rules.deposit_withdraw">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.deposit_withdraw"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.closeprofit'" :rules="rules.closeprofit">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.closeprofit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="持仓盯市盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.positionprofit'" :rules="rules.positionprofit">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.positionprofit"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.commission"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="期末结存" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.balance'" :rules="rules.balance">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.balance"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.currmargin'" :rules="rules.currmargin">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.currmargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交割保证金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.deliverymargin'" :rules="rules.deliverymargin">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.deliverymargin"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="可用资金" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.available'" :rules="rules.available">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.available"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="风险度" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.exercise_fee'" :rules="rules.exercise_fee">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.exercise_fee"
          ></el-input>
           </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="tzcapdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_tzcap('ruleForm1')" size="small">保存</el-button>
      </span>
     </el-dialog>


    <!-- 新增成交 -->
    <el-dialog title="新增成交" :visible.sync="tradeddialogVisible" width="90%">
        <div>
    <div class="mb">
      <el-button type="default" size="small" @click="addRow2">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData2">
        删行
      </el-button>
    </div>
     <el-form label-position="right" status-icon :rules="rules" :model="add_tradedData" ref="ruleForm2">
    <el-table :data="add_tradedData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
        <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
       <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradedate'" :rules="rules.tradedate">
         <el-date-picker style="width:100%" v-model="scope.row.tradedate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交时间" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradetime'" :rules="rules.tradetime">
         <el-time-picker style="width:100%" v-model="scope.row.tradetime" value-format="HH:mm:ss" placeholder="选择时间"></el-time-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.instrumentid'" :rules="rules.instrumentid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.direction'" :rules="rules.direction">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create>
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="开/平" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.offsetflag'" :rules="rules.offsetflag">
          <el-select  clearable v-model="scope.row.offsetflag" placeholder="请选择" filterable allow-create>
			         <el-option label="开仓" value="0"></el-option>
               <el-option label="平仓" value="1"></el-option>
               <el-option label="开今仓" value="3"></el-option>
               <el-option label="平昨仓" value="4"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="手数" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.volume'" :rules="rules.volume">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="rate" label="成交价" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.price'" :rules="rules.price">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.price"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.hedgeflag'" :rules="rules.hedgeflag">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.close_profit'" :rules="rules.close_profit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.close_profit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="成交序号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradeid'" :rules="rules.tradeid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.tradeid"
          ></el-input>
            </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="tradeddialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_addtraded('ruleForm2')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 修改成交 -->
    <el-dialog title="修改成交" :visible.sync="edittradeddialogVisible" width="90%">
        <div>
    <!-- <div class="mb">
      <el-button type="default" size="small" @click="addRow1">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData1">
        删行
      </el-button>
    </div> -->
     <el-form label-position="right" status-icon :rules="rules" :model="edit_tradedData" ref="ruleForm2">
    <el-table :data="edit_tradedData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
         <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
       <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradedate'" :rules="rules.tradedate">
         <el-date-picker style="width:100%" v-model="scope.row.tradedate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交时间" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradetime'" :rules="rules.tradetime">
         <el-time-picker style="width:100%" v-model="scope.row.tradetime" value-format="HH:mm:ss" placeholder="选择时间"></el-time-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.instrumentid'" :rules="rules.instrumentid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.direction'" :rules="rules.direction">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create>
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="开/平" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.offsetflag'" :rules="rules.offsetflag">
          <el-select  clearable v-model="scope.row.offsetflag" placeholder="请选择" filterable allow-create>
			         <el-option label="开仓" value="0"></el-option>
               <el-option label="平仓" value="1"></el-option>
               <el-option label="开今仓" value="3"></el-option>
               <el-option label="平昨仓" value="4"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="手数" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.volume'" :rules="rules.volume">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="rate" label="成交价" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.price'" :rules="rules.price">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.price"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.hedgeflag'" :rules="rules.hedgeflag">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.close_profit'" :rules="rules.close_profit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.close_profit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="成交序号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradeid'" :rules="rules.tradeid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.tradeid"
          ></el-input>
            </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="edittradeddialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_edittraded('ruleForm2')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 成交复制 -->
    <el-dialog title="修改成交" :visible.sync="copytradeddialogVisible" width="90%">
        <div>
    <div class="mb">
      <el-button type="default" size="small" @click="addRow2_copy">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData2_copy">
        删行
      </el-button>
    </div>
    <el-form label-position="right" status-icon :rules="rules" :model="copy_tradedData" ref="ruleForm2">
    <el-table :data="copy_tradedData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
         <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
       <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradedate'" :rules="rules.tradedate">
         <el-date-picker style="width:100%" v-model="scope.row.tradedate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交时间" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradetime'" :rules="rules.tradetime">
         <el-time-picker style="width:100%" v-model="scope.row.tradetime" value-format="HH:mm:ss" placeholder="选择时间"></el-time-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.instrumentid'" :rules="rules.instrumentid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.direction'" :rules="rules.direction">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create>
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="开/平" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.offsetflag'" :rules="rules.offsetflag">
          <el-select  clearable v-model="scope.row.offsetflag" placeholder="请选择" filterable allow-create>
			         <el-option label="开仓" value="0"></el-option>
               <el-option label="平仓" value="1"></el-option>
               <el-option label="开今仓" value="3"></el-option>
               <el-option label="平昨仓" value="4"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="手数" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.volume'" :rules="rules.volume">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="rate" label="成交价" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.price'" :rules="rules.price">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.price"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.hedgeflag'" :rules="rules.hedgeflag">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.commission"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.close_profit'" :rules="rules.close_profit">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.close_profit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="成交序号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradeid'" :rules="rules.tradeid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.tradeid"
          ></el-input>
            </el-form-item>
        </template>
      </el-table-column>
    </el-table>
    </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="copytradeddialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_copytraded('ruleForm2')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 资金调整 -->
     <el-dialog title="调整资金" :visible.sync="tztradeddialogVisible" width="90%">
        <div>
          <el-form label-position="right" status-icon :rules="rules" :model="tz_tradedData" ref="ruleForm2">
    <el-table :data="tz_tradedData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
         <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
       <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" :disabled="scope.$index == '0'" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradedate'" :rules="rules.tradedate">
         <el-date-picker style="width:100%" :disabled="scope.$index == '0'" v-model="scope.row.tradedate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="成交时间" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradetime'" :rules="rules.tradetime">
         <el-time-picker style="width:100%" :disabled="scope.$index == '0'" v-model="scope.row.tradetime" value-format="HH:mm:ss" placeholder="选择时间"></el-time-picker>
        </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.instrumentid'" :rules="rules.instrumentid">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.instrumentid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.direction'" :rules="rules.direction">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="开/平" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.offsetflag'" :rules="rules.offsetflag">
          <el-select  clearable v-model="scope.row.offsetflag" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
			         <el-option label="开仓" value="0"></el-option>
               <el-option label="平仓" value="1"></el-option>
               <el-option label="开今仓" value="3"></el-option>
               <el-option label="平昨仓" value="4"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="手数" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.volume'" :rules="rules.volume">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.volume"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="rate" label="成交价" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.price'" :rules="rules.price">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.price"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.hedgeflag'" :rules="rules.hedgeflag">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="手续费" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.commission'" :rules="rules.commission">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.commission"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="平仓盈亏" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.close_profit'" :rules="rules.close_profit">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.close_profit"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="成交序号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradeid'" :rules="rules.tradeid">
          <el-input
            placeholder="请输入内容" :disabled="scope.$index == '0'"
            v-model="scope.row.tradeid"
          ></el-input>
            </el-form-item>
        </template>
      </el-table-column>
    </el-table>
     </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="tztradeddialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_tztraded('ruleForm2')" size="small">保存</el-button>
      </span>
     </el-dialog>


    <!-- 新增持仓 -->
    <el-dialog title="新增持仓" :visible.sync="posdialogVisible" width="90%">
        <div>
    <div class="mb">
      <el-button type="default" size="small" @click="addRow3">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData3">
        删行
      </el-button>
    </div>
      <el-form label-position="right" status-icon :rules="rules" :model="add_posData" ref="ruleForm3">
    <el-table :data="add_posData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
       <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.realaccountcode'" :rules="rules.realaccountcode">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.brokerid'" :rules="rules.brokerid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradingday'" :rules="rules.tradingday">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
         <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.instrumentid'" :rules="rules.instrumentid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
        <el-table-column label="开仓日期" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.opendate'" :rules="rules.opendate">
         <el-date-picker style="width:100%" v-model="scope.row.opendate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="desc" label="成交序号" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.tradeid'" :rules="rules.tradeid">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.tradeid"
          ></el-input>
            </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.direction'" :rules="rules.direction">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create >
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="持仓量" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.volume'" :rules="rules.volume">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="开仓价" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.openprice'" :rules="rules.openprice">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.openprice"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.hedgeflag'" :rules="rules.hedgeflag">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
           </el-form-item>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-form-item :prop="scope.$index + '.margin'" :rules="rules.margin">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.margin"
          ></el-input>
          </el-form-item>
        </template>
      </el-table-column>
    </el-table>
      </el-form>
    </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="posdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_addpos('ruleForm3')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 修改持仓 -->
    <el-dialog title="修改持仓" :visible.sync="editposdialogVisible" width="90%">
      <div>
        <el-form label-position="right" status-icon :rules="rules" :model="edit_posData" ref="ruleForm3">
        <el-table :data="edit_posData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
         <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column prop="RealAccountCode" label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="brokerid" label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </template>
      </el-table-column>
       <el-table-column prop="instrumentid" label="合约" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
        </template>
      </el-table-column>
        <el-table-column label="开仓日期" sortable>
        <template slot-scope="scope">
         <el-date-picker style="width:100%" v-model="scope.row.opendate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create>
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="持仓量" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="开仓价" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.openprice"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.margin"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="数据来源" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.trade_source" placeholder="请选择" filterable allow-create>
			         <el-option label="人工录入" value="0"></el-option>
               <el-option label="系统导入" value="1"></el-option>
			     </el-select>
        </template>
      </el-table-column>
        </el-table>
        </el-form>
      </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="editposdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_editpos('ruleForm3')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 持仓复制 -->
    <el-dialog title="复制持仓" :visible.sync="copyposdialogVisible" width="90%">
      <div>
        <div class="mb">
      <el-button type="default" size="small" @click="addRow3_copy">
        <d2-icon name="plus"/>
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete" @click="delData3_copy">
        删行
      </el-button>
    </div>
    <el-form label-position="right" status-icon :rules="rules" :model="copy_posData" ref="ruleForm3">
        <el-table :data="copy_posData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
         <el-table-column type="selection" width="45" align="center"></el-table-column>
      <el-table-column type="index" label="序号">
      </el-table-column>
      <el-table-column prop="realaccountcode" label="柜台账号" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.realaccountcode"
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="brokerid" label="经纪商ID" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.brokerid"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column label="交易日期" sortable>
        <template slot-scope="scope">
         <el-date-picker style="width:100%" v-model="scope.row.tradingday" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="合约" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.instrumentid"
          ></el-input>
        </template>
      </el-table-column>
        <el-table-column label="开仓日期" sortable>
        <template slot-scope="scope">
         <el-date-picker style="width:100%" v-model="scope.row.opendate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="方向" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create>
			         <el-option label="买" value="0"></el-option>
               <el-option label="卖" value="1"></el-option>
			     </el-select>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="持仓量" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.volume"
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="开仓价" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.openprice"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column prop="status" label="投/保" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create>
			         <el-option label="投机" value="1"></el-option>
               <el-option label="套利" value="2"></el-option>
               <el-option label="套保" value="3"></el-option>
			     </el-select>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="保证金占用" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.margin"
          ></el-input>
        </template>
      </el-table-column>
       <el-table-column prop="trade_source" label="数据来源" sortable>
        <template slot-scope="scope">
          <el-select  clearable v-model="scope.row.trade_source" placeholder="请选择" filterable allow-create>
			         <el-option label="人工录入" value="0"></el-option>
               <el-option label="系统导入" value="1"></el-option>
			     </el-select>
        </template>
      </el-table-column>
        </el-table>
    </el-form>
      </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="copyposdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_copypos('ruleForm3')" size="small">保存</el-button>
      </span>
    </el-dialog>
    <!-- 持仓调整 -->
     <el-dialog title="调整持仓" :visible.sync="tzposdialogVisible" width="90%">
       <div>
         <el-form label-position="right" status-icon :rules="rules" :model="tz_posData" ref="ruleForm3">
        <el-table :data="tz_posData" border :cell-style="{ 'text-align': 'center' }" :header-cell-style="{ 'text-align': 'center' }" @selection-change='selectRow'>
          <el-table-column type="selection" width="45" align="center"></el-table-column>
          <el-table-column type="index" label="序号">
          </el-table-column>
          <el-table-column prop="realaccountcode" label="柜台账号" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.realaccountcode"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="brokerid" label="经纪商ID" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.brokerid"
              ></el-input>
            </template>
          </el-table-column>
           <el-table-column label="交易日期" sortable>
            <template slot-scope="scope">
             <el-date-picker style="width:100%" v-model="scope.row.tradingday" :disabled="scope.$index == '0'" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
            </template>
          </el-table-column>
           <el-table-column prop="status" label="合约" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.instrumentid"
              ></el-input>
            </template>
          </el-table-column>
            <el-table-column label="开仓日期" sortable>
            <template slot-scope="scope">
             <el-date-picker style="width:100%" v-model="scope.row.opendate" :disabled="scope.$index == '0'" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
            </template>
          </el-table-column>
           <el-table-column prop="status" label="方向" sortable>
            <template slot-scope="scope">
              <el-select  clearable v-model="scope.row.direction" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
		    	         <el-option label="买" value="0"></el-option>
                   <el-option label="卖" value="1"></el-option>
		    	     </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="price" label="持仓量" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.volume"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="price" label="开仓价" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.openprice"
              ></el-input>
            </template>
          </el-table-column>
           <el-table-column prop="status" label="投/保" sortable>
            <template slot-scope="scope">
              <el-select  clearable v-model="scope.row.hedgeflag" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
		    	         <el-option label="投机" value="1"></el-option>
                   <el-option label="套利" value="2"></el-option>
                   <el-option label="套保" value="3"></el-option>
		    	     </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="desc" label="保证金占用" sortable>
            <template slot-scope="scope">
              <el-input
                placeholder="请输入内容" :disabled="scope.$index == '0'"
                v-model="scope.row.margin"
              ></el-input>
            </template>
          </el-table-column>
           <el-table-column prop="desc" label="成交序号" sortable>
             <template slot-scope="scope">
               <el-input
                 placeholder="请输入内容" :disabled="scope.$index == '0'"
                 v-model="scope.row.tradeid"
               ></el-input>
             </template>
           </el-table-column>
           <!-- <el-table-column prop="trade_source" label="数据来源" sortable>
            <template slot-scope="scope">
              <el-select  clearable v-model="scope.row.trade_source" placeholder="请选择" filterable allow-create :disabled="scope.$index == '0'">
		    	         <el-option label="人工录入" value="0"></el-option>
                   <el-option label="系统导入" value="1"></el-option>
		    	     </el-select>
            </template>
          </el-table-column> -->
        </el-table>
         </el-form>
      </div>
      <span span slot="footer" class="dialog-footer">
        <el-button @click="tzposdialogVisible = false" size="small">取消</el-button>
        <el-button type="primary" @click="change_tzpos('ruleForm3')" size="small">保存</el-button>
      </span>
     </el-dialog>

     <!-- 导入弹框 -->
     <!-- 资金 -->
     <el-dialog title="导入柜台账户资金信息" :visible.sync="drcapdialogVisible" width="90%">
       <div>
        <el-table :data="drcaptableDatacap" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row>
        <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="prebalance" label="期初结存">
        </el-table-column>
        <el-table-column prop="deposit_withdraw" label="出入金">
        </el-table-column>
        <el-table-column prop="closeprofit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="positionprofit" label="持仓盯市盈亏">
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
        <el-table-column prop="balance" label="期末结存">
        </el-table-column>
        <el-table-column prop="currmargin" label="保证金占用">
        </el-table-column>
         <el-table-column prop="deliverymargin" label="交割保证金">
        </el-table-column>
        <el-table-column prop="available" label="可用资金">
        </el-table-column>
         <el-table-column prop="exercise_fee" label="风险度">
        </el-table-column>
      </el-table>
       <el-pagination
      @size-change="handleSizeChange1"
      @current-change="handleCurrentChange1"
      background
      :current-page="capForm.currentPage"
      :page-size="capForm.pageSize"
      layout="total, prev, pager, next"
      :total="capForm.totalPage"
    >
      </el-pagination>
      </div>
      <span span slot="footer" class="dialog-footer">
        <!-- <el-button @click="tzposdialogVisible = false">取消</el-button> -->
        <el-button type="primary" @click="drcap" size="small">上传数据</el-button>
      </span>
     </el-dialog>
     <!-- 成交 -->
     <el-dialog title="导入柜台账户成交记录" :visible.sync="drtradeddialogVisible" width="90%">
       <div>
         <el-table :data="drtradedableDatatraded" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row>
       <el-table-column label="序号" type="index" width="55">
        </el-table-column>
        <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
         <el-table-column prop="tradedate" label="成交日期">
        </el-table-column>
         <el-table-column prop="tradetime" label="成交时间">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="direction" label="方向">
        </el-table-column>
        <el-table-column prop="offsetflag" label="开/平" >
        </el-table-column>
        <el-table-column prop="volume" label="手数">
        </el-table-column>
        <el-table-column prop="price" label="成交价">
        </el-table-column>
        <el-table-column prop="hedgeflag" label="投/保" >
        </el-table-column>
        <el-table-column prop="commission" label="手续费">
        </el-table-column>
        <el-table-column prop="close_profit" label="平仓盈亏">
        </el-table-column>
        <el-table-column prop="tradeid" label="成交序号">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange2"
      @current-change="handleCurrentChange2"
      background
      :current-page="tradedForm.currentPage"
      :page-size="tradedForm.pageSize"
      layout="total, prev, pager, next"
      :total="tradedForm.totalPage"
    >
    </el-pagination>
      </div>
      <span span slot="footer" class="dialog-footer">
        <!-- <el-button @click="tzposdialogVisible = false">取消</el-button> -->
        <el-button type="primary" @click="drtraded" size="small">上传数据</el-button>
      </span>
     </el-dialog>
     <!-- 持仓 -->
     <el-dialog title="导入柜台账户持仓明细" :visible.sync="drposdialogVisible" width="90%">
       <div>
        <el-table :data="drpostableDatapos" border style="width: 100%" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" highlight-current-row @selection-change="handleSelectionChange">
         <el-table-column label="序号" type="index" width="55">
        </el-table-column>
         <el-table-column prop="realaccountcode" label="柜台账号">
        </el-table-column>
        <el-table-column prop="brokerid" label="经纪商ID">
        </el-table-column>
         <el-table-column prop="tradingday" label="交易日期">
        </el-table-column>
        <el-table-column prop="instrumentid" label="合约">
        </el-table-column>
        <el-table-column prop="opendate" label="开仓日期">
        </el-table-column>
        <el-table-column prop="tradeid" label="成交序号">
        </el-table-column>
        <el-table-column prop="direction" label="方向">
        </el-table-column>
        <el-table-column prop="volume" label="持仓量">
        </el-table-column>
        <el-table-column prop="openprice" label="开仓价">
        </el-table-column>
         <el-table-column prop="hedgeflag" label="投/保">
        </el-table-column>
        <el-table-column prop="margin" label="保证金">
        </el-table-column>
      </el-table>
        <el-pagination
      @size-change="handleSizeChange3"
      @current-change="handleCurrentChange3"
      background
      :current-page="posForm.currentPage"
      :page-size="posForm.pageSize"
      layout="total, prev, pager, next"
      :total="posForm.totalPage"
    >
    </el-pagination>
      </div>
      <span span slot="footer" class="dialog-footer">
        <!-- <el-button @click="tzposdialogVisible = false">取消</el-button> -->
        <el-button type="primary" @click="drpos" size="small">上传数据</el-button>
      </span>
     </el-dialog>
  </div>
</template>
<script>
import { conrealtraded, addrealtraded, conrealpos, addrealpos, conrealcap, addrealcap, coninstrumentid, addleadreal } from '../../../../../api/url_lcc';
export default {
  data() {
    return {
      instrumentidList:[],
      // 资金
      capdialogVisible:false,
      editcapdialogVisible:false,
      copycapdialogVisible:false,
      tzcapdialogVisible:false,
      // 成交
      tradeddialogVisible:false,
      edittradeddialogVisible:false,
      copytradeddialogVisible:false,
      tztradeddialogVisible:false,
      // 持仓
      posdialogVisible:false,
      editposdialogVisible:false,
      copyposdialogVisible:false,
      tzposdialogVisible:false,

      postableData:[],
      capForm:{
        page: 1, //当前页
        pageSize: 20,
        totalPage: 1,
        brokerid:"",
        realaccountcode:"",
        settlement_status:"",
        trade_source:"0",
        start_date:"",
        end_date:"",
      },
      captableData:[],
      add_capData:[],
      edit_capData:[],
      copy_capData:[],
      tz_capData:[{}],

      futurestableData:[],
      tradedForm:{
         page: 1, //当前页
        pageSize: 20,
        totalPage: 1,
        brokerid:"",
        realaccountcode:"",
        instrumentid:"",
        offsetflag:"",
        tradeid:"",
        trade_source:"0",
        start_date:"",
        end_date:"",
      },
      add_tradedData:[],
      edit_tradedData:[],
      copy_tradedData:[],
      tz_tradedData:[],

      tradedableData:[],
      posForm:{
        page: 1, //当前页
        pageSize: 20,
        totalPage: 1,
        brokerid:"",
        realaccountcode:"",
        instrumentid:"",
        product_id:"",
        trade_source:"0",
        start_date:"",
        end_date:"",
      },
      add_posData:[],
      edit_posData:[],
      copy_posData:[],
      tz_posData:[],
      // 资金限制
      ruleForm1:{
           "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",
            "balance":"",
            "currmargin":"",
            "deliverymargin":"",
            "available":"",
            "exercise_fee":""
      },
      // 成交限制
      ruleForm2:{
           "realaccountcode":"",
           "brokerid":"",                             
           "tradingday":"",
           "tradedate":"",  
           "tradetime":"",    
           "instrumentid":"",  
           "direction":"",           
           "offsetflag":"",          
           "volume":"",          
           "price":"",	       
           "hedgeflag":"",          
           "commission":"",     
           "close_profit":"",      
           "tradeid":""
      },
      // 持仓限制
       ruleForm3:{
           "realaccountcode":"",
           "brokerid":"",                             
           "tradingday":"",
           "instrumentid":"", 
           "opendate":"",
           "tradeid":"",
           "direction":"", 
           "volume":"",
           "openprice":"", 
           "hedgeflag":"",          
           "margin":"",     
           
      },
        // 限制
      rules: {
            realaccountcode: [
              { required: true, message: '请输入客户号', trigger: 'blur' }
            ],
            brokerid: [
              { required: true, message: '请输入经纪商ID', trigger: 'blur' }
            ],
            tradingday: [
              { type: 'string', required: true, message: '请选择交易日期', trigger: 'change' }
            ],
            prebalance: [
              { required: true, message: '请输入期初结存', trigger: 'blur' },
            ],
            deposit_withdraw: [
             { required: true, message: '请输入出入金', trigger: 'blur' },
            ],
            closeprofit: [
               { required: true, message: '请输入平仓盈亏', trigger: 'blur' },
            ],
            positionprofit: [
              { required: true, message: '请输入持仓盯市盈亏', trigger: 'blur' },
            ],
            commission: [
             { required: true, message: '请输入手续费', trigger: 'blur' }
            ],
             balance: [
              { required: true, message: '请输入期末结存', trigger: 'blur' },
            ],
             currmargin: [
              { required: true, message: '请输入保证金占用', trigger: 'blur' },
            ],
             deliverymargin: [
              { required: true, message: '请输入交割保证金', trigger: 'blur' },
            ],
             available: [
              { required: true, message: '请输入可用资金', trigger: 'blur' },
            ],
            exercise_fee: [
              { required: true, message: '请输入风险', trigger: 'blur' },
            ],
            trade_source: [
              { required: true, message: '请选择数据来源', trigger: 'change' },
            ],
            tradedate: [
              { type: 'string', required: true, message: '请选择成交日期', trigger: 'change' }
            ],
            tradetime: [
              { type: 'string', required: true, message: '请选择成交时间', trigger: 'change' }
            ],
            instrumentid: [
              { required: true, message: '请输入合约', trigger: 'blur' },
            ],
            direction: [
              { required: true, message: '请选择方向', trigger: 'change' },
            ],
            offsetflag: [
              { required: true, message: '请选择开平', trigger: 'change' },
            ],
             volume: [
              { required: true, message: '请输入手数', trigger: 'blur' },
            ],
             price: [
              { required: true, message: '请输入成交价', trigger: 'blur' },
            ],
             hedgeflag: [
              { required: true, message: '请选择投保', trigger: 'change' },
            ],
             close_profit: [
              { required: true, message: '请输入平仓盈亏', trigger: 'blur' },
            ],
             tradeid: [
              { required: true, message: '请输入成交序号', trigger: 'blur' },
            ],
            opendate: [
              { type: 'string', required: true, message: '请选择开仓日期', trigger: 'change' }
            ],
             openprice: [
              { required: true, message: '请输入开仓价', trigger: 'blur' },
            ],
            margin: [
              { required: true, message: '请输入保证金', trigger: 'blur' },
            ],
          },
            // ///////////////////////////////时间限制
       cappickerOptionsStart: {
          disabledDate: time => {
            let endDateVal = this.capForm.end_date;
            if (endDateVal) {
              return time.getTime() > new Date(endDateVal).getTime();
            }
          }
        },
       cappickerOptionsEnd: {
          disabledDate: time => {
            let beginDateVal = this.capForm.start_date;
            if (beginDateVal) {
              return (
                time.getTime() <
                new Date(beginDateVal).getTime() - 1 * 24 * 60 * 60 * 1000
              );
            }
          }
        },
        tradedpickerOptionsStart: {
          disabledDate: time => {
            let endDateVal = this.tradedForm.end_date;
            if (endDateVal) {
              return time.getTime() > new Date(endDateVal).getTime();
            }
          }
        },
       tradedpickerOptionsEnd: {
          disabledDate: time => {
            let beginDateVal = this.tradedForm.start_date;
            if (beginDateVal) {
              return (
                time.getTime() <
                new Date(beginDateVal).getTime() - 1 * 24 * 60 * 60 * 1000
              );
            }
          }
        },
        pospickerOptionsStart: {
          disabledDate: time => {
            let endDateVal = this.posForm.end_date;
            if (endDateVal) {
              return time.getTime() > new Date(endDateVal).getTime();
            }
          }
        },
       pospickerOptionsEnd: {
          disabledDate: time => {
            let beginDateVal = this.posForm.start_date;
            if (beginDateVal) {
              return (
                time.getTime() <
                new Date(beginDateVal).getTime() - 1 * 24 * 60 * 60 * 1000
              );
            }
          }
        },
        // 导入
        uploadUrl:`/user/lead/`,
        drcaptableData:[],
        drtradedableData:[],
        drpostableData:[],
        offsetflagList:[{
          offsetflag: '1',
          name: '开仓'
        }, {
          offsetflag: '2',
          name: '平仓'
        }, {
          offsetflag: '3',
          name: '平今仓'
        }, {
          offsetflag: '4',
          name: '平昨仓'
        }],
        value: '',
        hedgeflag:[{
          hedgeflag: '1',
          name: '投机'
        }, {
          hedgeflag: '2',
          name: '套利'
        }, {
          hedgeflag: '3',
          name: '套保'
        }],
        drcapdialogVisible:false,
        drtradeddialogVisible:false,
        drposdialogVisible:false,
    }
  },
  methods: {
    // 数据来源
    formatterSource(row,column){
          if (row.trade_source == "0") {
             return '人工录入';
         } else if (row.trade_source == "1") {
             return '系统导入';
         } 
    },
    // 开平
    formatterKP(row,column){
          if (row.trade_source == "开仓") {
             return '1';
         } else if (row.trade_source == "平仓") {
             return '2';
         } else if (row.trade_source == "平今仓") {
             return '3';
         } else if (row.trade_source == "平昨仓") {
             return '4';
         } 
    },
    // 投保
    formatterTB(row,column){
          if (row.trade_source == "投机") {
             return '1';
         } else if (row.trade_source == "套利") {
             return '2';
         } else if (row.trade_source == "套保") {
             return '3';
         }
    },
    // 是否调整
    formatterStatus(row,column){
       return row.adjust_status = "0"?'否':'是'
   },
   // // // // // // // // // // // // // // // // // // // // // // // // // // // //  // // // // // // // // // // // 导入
      handleAvatarSuccess (res, file) {
        // this.uploadloading.close();
        console.log(444444,res.result);
        if (res && res.errcode === "1") {
           this.$message({
           message: '导入成功',
           type: 'success',
          })
          this.drcaptableData = [];
          this.drtradedableData = [];
          this.drpostableData = [];
          var data1 = res.result["资金信息"];
          for (var i = 0; i < data1.length; i++) {
            this.drcaptableData[i] = {
              "realaccountcode": data1[i].柜台账号,
              "brokerid": data1[i].经纪商ID,                             
              "tradingday":data1[i].交易日期,
              "prebalance":data1[i].期初结存,
              "deposit_withdraw":data1[i].出入金,
              "closeprofit":data1[i].平仓盈亏,
              "positionprofit":data1[i].持仓盯市盈亏,
              "commission":data1[i].手续费,
              "balance":data1[i].期末结存,
              "currmargin":data1[i].保证金占用,
              "deliverymargin":data1[i].交割保证金,
              "available":data1[i].可用资金,
              "exercise_fee":data1[i].风险度,
            }
          }
          var data2 = res.result["成交记录"];
          for (var i = 0; i < data2.length; i++) {
            this.drtradedableData[i] = {
              "realaccountcode": data2[i].柜台账号,
              "brokerid": data2[i].经纪商ID,                             
              "tradingday":data2[i].交易日期,
              "tradedate":data2[i].成交日期,
              "tradetime":data2[i].成交时间,
              "instrumentid":data2[i].合约,
              "direction":data2[i].方向,
              "offsetflag":data2[i]["开/平"],
              "volume":data2[i].手数,
              "price":data2[i].成交价,
              "hedgeflag":data2[i]["投/保"],
              "commission":data2[i].手续费,
              "close_profit":data2[i].平仓盈亏,
              "tradeid":data2[i].成交序号,
            }
          }
          var data3 = res.result["持仓明细"];
          for (var i = 0; i < data3.length; i++) {
            this.drpostableData[i] = {
              "realaccountcode": data3[i].柜台账号,
              "brokerid": data3[i].经纪商ID,                             
              "tradingday":data3[i].交易日期,
              "instrumentid":data3[i].合约,
              "opendate":data3[i].开仓日期,
              "tradeid":data3[i].成交序号,
              "direction":data3[i].方向,
              "volume":data3[i].持仓量,
              "openprice":data3[i].开仓价,
              "hedgeflag":data3[i]["投/保"],
              "margin":data3[i].保证金,
            }
          }
        } else {
          this.$message.error(res.msg);
        }
      },
      // 资金导入
      handleAvatarSuccesscap (res, file) {
        // this.uploadloading.close();
        console.log(444444,res.result);
        if (res && res.errcode === "1") {
           this.$message({
           message: '导入成功',
           type: 'success',
          })
          this.drcapdialogVisible = true;
          this.drcaptableDatacap = [];
          var data1 = res.result["资金信息"];
          for (var i = 0; i < data1.length; i++) {
            this.drcaptableDatacap[i] = {
              "realaccountcode": data1[i].柜台账号,
              "brokerid": data1[i].经纪商ID,                             
              "tradingday":data1[i].交易日期,
              "prebalance":data1[i].期初结存,
              "deposit_withdraw":data1[i].出入金,
              "closeprofit":data1[i].平仓盈亏,
              "positionprofit":data1[i].持仓盯市盈亏,
              "commission":data1[i].手续费,
              "balance":data1[i].期末结存,
              "currmargin":data1[i].保证金占用,
              "deliverymargin":data1[i].交割保证金,
              "available":data1[i].可用资金,
              "exercise_fee":data1[i].风险度,
            }
          }
         
        } else {
          this.$message.error(res.msg);
        }
      },
      drcap(){
        let params = { 
          "operation":"LEAD",
          data:this.drcaptableData
        };
        addrealcap(params).then(res => {
            if (res.errcode == "1") {
                this.$message.success(res.result);
                this.drcapdialogVisible = false;
                this.handle_realaccouncap()
            } else {
                this.$message.error(res.msg);
            }
             });
      },
      // 成交导入
       handleAvatarSuccesstraded (res, file) {
        // this.uploadloading.close();
        console.log(444444,res.result);
        if (res && res.errcode === "1") {
           this.$message({
           message: '导入成功',
           type: 'success',
          })
          this.drtradeddialogVisible = true;
          this.drtradedableDatatraded = [];
          var data2 = res.result["成交记录"];
          for (var i = 0; i < data2.length; i++) {
            this.drtradedableDatatraded[i] = {
              "realaccountcode": data2[i].柜台账号,
              "brokerid": data2[i].经纪商ID,                             
              "tradingday":data2[i].交易日期,
              "tradedate":data2[i].成交日期,
              "tradetime":data2[i].成交时间,
              "instrumentid":data2[i].合约,
              "direction":data2[i].方向,
              "offsetflag":data2[i]["开/平"],
              "volume":data2[i].手数,
              "price":data2[i].成交价,
              "hedgeflag":data2[i]["投/保"],
              "commission":data2[i].手续费,
              "close_profit":data2[i].平仓盈亏,
              "tradeid":data2[i].成交序号,
            }
          }
         
        } else {
          this.$message.error(res.msg);
        }
      },
       drtraded(){
          var drtradedableData = [];
        var drtradedableData = this.drtradedableData;
        drtradedableData.forEach(function(item, index) {
           var data1 = item.offsetflag
           var data2 = item.direction
           var data3 = item.hedgeflag
         if (data1 == "开仓") {
             item.offsetflag = '1';
         } else if (data1 == "平仓") {
             item.offsetflag = '2';
         } else if (data1 == "平今仓") {
             item.offsetflag = '3';
         } else if (data1 == "平昨仓") {
             item.offsetflag = '4';
         }
          if (data2 == "买") {
             item.direction = '0';
         } else if (data2 == "卖") {
             item.direction = '1';
         }
          if (data3 == "投机") {
             item.hedgeflag = '1';
         } else if (data3 == "套利") {
             item.hedgeflag = '2';
         } else if (data3 == "套保") {
             item.hedgeflag = '3';
         }
       })
        let params = {
          "operation":"LEAD",
          data:this.drtradedableData
        };
        addrealtraded(params).then(res => {
            if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.drtradeddialogVisible = false;
                 this.handle_realaccouncap()
            } else {
                this.$message.error(res.msg);
            }
             });
      },
      // 持仓明细
       handleAvatarSuccesspos (res, file) {
        // this.uploadloading.close();
        console.log(444444,res.result);
        if (res && res.errcode === "1") {
           this.$message({
           message: '导入成功',
           type: 'success',
          })
          this.drposdialogVisible = true;
          this.drpostableDatapos = [];
          var data3 = res.result["持仓明细"];
          for (var i = 0; i < data3.length; i++) {
            this.drpostableDatapos[i] = {
              "realaccountcode": data3[i].柜台账号,
              "brokerid": data3[i].经纪商ID,                             
              "tradingday":data3[i].交易日期,
              "instrumentid":data3[i].合约,
              "opendate":data3[i].开仓日期,
              "tradeid":data3[i].成交序号,
              "direction":data3[i].方向,
              "volume":data3[i].持仓量,
              "openprice":data3[i].开仓价,
              "hedgeflag":data3[i]["投/保"],
              "margin":data3[i].保证金,
            }
          }
        } else {
          this.$message.error(res.msg);
        }
      },
      drpos(){
         var drpostableData = [];
        var drpostableData = this.drpostableData;
        drpostableData.forEach(function(item, index) {
           var data5 = item.direction
           var data6 = item.hedgeflag
          if (data5 == "买") {
             item.direction = '0';
         } else if (data5 == "卖") {
             item.direction = '1';
         }
          if (data6 == "投机") {
             item.hedgeflag = '1';
         } else if (data6 == "套利") {
             item.hedgeflag = '2';
         } else if (data6 == "套保") {
             item.hedgeflag = '3';
         }
       })
        let params = {
            "operation":"LEAD",
            data:this.drpostableData
        };
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.drposdialogVisible = false;
                 this.handle_realaccouncap()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
      },
      // 导入预览后上传后台
      dr_all(){
        var drtradedableData = [];
        var drtradedableData = this.drtradedableData;
        drtradedableData.forEach(function(item, index) {
           var data1 = item.offsetflag
           var data2 = item.direction
           var data3 = item.hedgeflag
         if (data1 == "开仓") {
             item.offsetflag = '1';
         } else if (data1 == "平仓") {
             item.offsetflag = '2';
         } else if (data1 == "平今仓") {
             item.offsetflag = '3';
         } else if (data1 == "平昨仓") {
             item.offsetflag = '4';
         }
          if (data2 == "买") {
             item.direction = '0';
         } else if (data2 == "卖") {
             item.direction = '1';
         }
          if (data3 == "投机") {
             item.hedgeflag = '1';
         } else if (data3 == "套利") {
             item.hedgeflag = '2';
         } else if (data3 == "套保") {
             item.hedgeflag = '3';
         }
       })
        var drpostableData = [];
        var drpostableData = this.drpostableData;
        drpostableData.forEach(function(item, index) {
           var data5 = item.direction
           var data6 = item.hedgeflag
          if (data5 == "买") {
             item.direction = '0';
         } else if (data5 == "卖") {
             item.direction = '1';
         }
          if (data6 == "投机") {
             item.hedgeflag = '1';
         } else if (data6 == "套利") {
             item.hedgeflag = '2';
         } else if (data6 == "套保") {
             item.hedgeflag = '3';
         }
       })
       let params = {
            "operation":"LEAD",
            data:{
              "cap":this.drcaptableData,
              "trade":this.drtradedableData,
              "pos":this.drpostableData
            }
        };
        addleadreal(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.capdialogVisible = false
                 this.handle_realaccouncap()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
      },
    // // // // // // // // // // // // // // // // // // // // // // // // // // // // 资金
      // 每页数
    handleSizeChange1(val) {
      this.capForm.pageSize = val;
      this.capForm.page = 1;
      this.handle_realaccouncap1();
    },
    // 当前页
    handleCurrentChange1(val) {
      this.capForm.page = val;
      this.handle_realaccouncap1();
    },
    handle_realaccouncap(){
      this.capForm.page = 1;
      this.handle_realaccouncap1()
    },
    // 资金明细
    handle_realaccouncap1(){
      conrealcap(this.capForm).then(res => {
            // if (res.errcode == "1") {
              this.captableData = []
               var data = res.result.results
                this.capForm.totalPage = res.result.count;
                for (var i = 0; i <= data.length; i++) {
                  this.captableData[i] = {
                    available: data[i].Available,
                    balance: data[i].Balance,
                    brokerid: data[i].BrokerID,
                    clientequity: data[i].ClientEquity,
                    closeprofit: data[i].CloseProfit,
                    commission: data[i].Commission,
                    currmargin: data[i].CurrMargin,
                    deliveryfee: data[i].DeliveryFee,
                    deliverymargin: data[i].DeliveryMargin,
                    deposit_withdraw: data[i].DepositWithdraw,
                    margincall: data[i].MarginCall,
                    positionprofit: data[i].PositionProfit,
                    prebalance: data[i].PreBalance,
                    realaccountcode: data[i].RealAccountCode,
                    riskdegree: data[i].RiskDegree,
                    tradingday: data[i].TradingDay,
                    adjust_status: data[i].adjust_status,
                    // creator: data[i].creator,
                    exercise_fee: data[i].exercise_fee,
                    // trade_source: data[i].trade_source,
                  }
              }
            }).catch(err =>{
              // alert(21212)
          // this.$message.error(err.msg);
        });
    },
    // 新增
    add_cap(){
      this.capdialogVisible = true;
    },
    // 新增保存
    change_addcap(ruleForm1){
       let params = {
           "operation":"ADD",
            data:this.add_capData
        };
       const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm1].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealcap(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.capdialogVisible = false
                 this.handle_realaccouncap()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
        });
    },
    // 修改
    edit_cap(){
       if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
          this.editcapdialogVisible = true
         this.edit_capData = this.multipleSelection
      }
    },
    // 修改保存
    change_editcap(ruleForm1){
       let params = {
           "operation":"MOD",
            data:{
                "realaccountcode":this.edit_capData[0].realaccountcode,
                "brokerid":this.edit_capData[0].brokerid,                             
                "tradingday":this.edit_capData[0].tradingday,
                "prebalance":this.edit_capData[0].prebalance,
                "deposit_withdraw":this.edit_capData[0].deposit_withdraw,
                "closeprofit":this.edit_capData[0].closeprofit,
                "positionprofit":this.edit_capData[0].positionprofit,
                "commission":this.edit_capData[0].commission,
                "balance":this.edit_capData[0].balance,
                "currmargin":this.edit_capData[0].currmargin,
                "deliverymargin":this.edit_capData[0].deliverymargin,
                "available":this.edit_capData[0].available,
                "exercise_fee":this.edit_capData[0].exercise_fee
            }
        };
         const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm1].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealcap(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.editcapdialogVisible = false
                 this.handle_realaccouncap()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
      });
    },
    // 复制
    copy_cap(){
       if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.copycapdialogVisible = true;
         this.copy_capData = this.multipleSelection
      }
      
    },
    // 复制保存
     change_copycap(ruleForm1){
       let params = {
           "operation":"ADD",
            data:this.copy_capData
        };
        const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm1].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealcap(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.copycapdialogVisible = false
                 this.handle_realaccouncap()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
       });
    },
    // 删除
    del_cap(){
       this.$confirm('是否删除该柜台账户资金信息?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let params = {
           "operation":"DEL",
           "data": this.multipleSelection
        };
        addrealcap(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.handle_realaccouncap()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
    },
    // 刷新
    RefreshCurrent_cap(){
      this.handle_realaccouncap()
    },
    // 调整
    tz_cap(){
        if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.tzcapdialogVisible = true;
         this.tz_capData = []
         console.log(1,this.multipleSelection)
          var data = this.multipleSelection;
          for (var i = 0; i <= data.length; i++) {
            this.tz_capData[0] = {
              "realaccountcode":data[0].realaccountcode,
              "brokerid":data[0].brokerid,                             
              "tradingday":data[0].tradingday,
              "prebalance":data[0].prebalance,
              "deposit_withdraw":data[0].deposit_withdraw,
              "closeprofit":data[0].closeprofit,
              "positionprofit":data[0].positionprofit,
              "commission":data[0].commission,
              "balance":data[0].balance,
              "currmargin":data[0].currmargin,
              "deliverymargin":data[0].deliverymargin,
              "available":data[0].available,
              "exercise_fee":data[0].exercise_fee
            };
          }
          var list = {};
        this.tz_capData.push(list)
        // this.rowNum += 1;
         console.log('tiaozheng',this.tz_capData)
      }
    },
    // 调整保存
    change_tzcap(ruleForm1){
       let params = {
           "operation":"ADJUST",
            data:this.tz_capData
        };
       const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm1].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealcap(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.tzcapdialogVisible = false
                 this.handle_realaccouncap()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
      });
    },
     // // // // // // // // // // // // // // // // // // // // // // // // // // // // 成交
       // 每页数
    handleSizeChange2(val) {
      this.tradedForm.pageSize = val;
      this.tradedForm.page = 1;
      this.handle_realtraded1();
    },
    // 当前页
    handleCurrentChange2(val) {
      this.tradedForm.page = val;
      this.handle_realtraded1();
    },
    handle_realtraded(){
      this.tradedForm.page = 1;
      this.handle_realtraded1()
    },
    // 成交明细
    handle_realtraded1(){
      conrealtraded(this.tradedForm).then(res => {
            // if (res.errcode == "1") {
               this.tradedableData = []
               var data = res.result.results
                this.tradedForm.totalPage = res.result.count;
                for (var i = 0; i <= data.length; i++) {
                  this.tradedableData[i] = {
                   settlement_status: data[i].settlement_status,
                   adjust_status: data[i].adjust_status,
                   realaccountcode: data[i].RealAccountCode,
                   realaccountname: data[i].RealAccountName,
                   exchangename: data[i].ExchangeName,
                   brokerid: data[i].BrokerID,
                   tradingday: data[i].dTradingDay,	
                   tradedate: data[i].dTradeDate,
                   tradetime: data[i].TradeTime,
                   productname: data[i].ProductName,
                   instrumentid: data[i].InstrumentID,
                   direction: data[i].Direction,	
                   directionname: data[i].DirectionName,		
                   offsetflag: data[i].OffsetFlag,
                   offsetflagname: data[i].OffsetFlagName,
                   price: data[i].Price,
                   volume: data[i].Volume,
                   amount: data[i].amount,
                   hedgeflag: data[i].HedgeFlag,
                   hedgeflagname: data[i].HedgeFlagName,
                   commission: data[i].commission,
                   close_profit: data[i].close_profit,
                   trade_source: data[i].trade_source,
                   creator: data[i].creator,
                   tradeid: data[i].TradeID,
                  }
              }
           }).catch(err =>{
          this.$message.error(err.msg);
        });
    },
    // 查询合约
    // handle_instrument(){
    //  let params = {
    //       productid: "",
    //   };
    //   coninstrumentid(params).then(res => {
    //       if (res.errcode == "1") {
    //         this.instrumentidList = []
    //         var data1 = res.result
    //         for (var i = 0; i < data1.length; i++) {
    //                 this.instrumentidList[i] = {
    //                     instrumentid: data1[i]['InstrumentID'],
    //                     InstrumentName: data1[i]['InstrumentName']
    //                 };
    //             }
 
    //       } else {
    //           this.$message.error(res.msg);
    //       }
    //   });
    // },
    // 新增
    add_traded(){
      this.tradeddialogVisible = true;
    },
    // 新增保存
    change_addtraded(ruleForm2){
      let params = {
           "operation":"ADD",
            data:this.add_tradedData
        };
         const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm2].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealtraded(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.tradeddialogVisible = false
                 this.handle_realtraded()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
        });
    },
    // 修改
    edit_traded(){
      console.log(121,this.multipleSelection)
        if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
          this.edittradeddialogVisible = true
         this.edit_tradedData = this.multipleSelection
      }
    },
    // 修改保存
    change_edittraded(ruleForm2){
       let params = {
           "operation":"MOD",
            data:{
              "realaccountcode":this.edit_tradedData[0].realaccountcode,
                "brokerid":this.edit_tradedData[0].brokerid,                             
                "tradingday":this.edit_tradedData[0].tradingday,
                "tradedate":this.edit_tradedData[0].tradedate,
                "tradetime":this.edit_tradedData[0].tradetime,
                "instrumentid":this.edit_tradedData[0].instrumentid,
                "direction":this.edit_tradedData[0].direction,
                "offsetflag":this.edit_tradedData[0].offsetflag,
                "volume":this.edit_tradedData[0].volume,
                "price":this.edit_tradedData[0].price,
                "hedgeflag":this.edit_tradedData[0].hedgeflag,
                "commission":this.edit_tradedData[0].commission,
                "close_profit":this.edit_tradedData[0].close_profit,
                "tradeid":this.edit_tradedData[0].tradeid
              }
        };
          const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm2].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealtraded(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.edittradeddialogVisible = false
                 this.handle_realtraded()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
     // 复制
    copy_traded(){
       if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.copytradeddialogVisible = true;
         this.copy_tradedData = this.multipleSelection
      }
      
    },
    // 复制保存
     change_copytraded(ruleForm2){
       let params = {
           "operation":"ADD",
            data:this.copy_tradedData
        };
           const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm2].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealtraded(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.copytradeddialogVisible = false
                 this.handle_realtraded()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
    // 删除
    del_traded(){
       this.$confirm('是否删除该柜台账户成交信息?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let params = {
           "operation":"DEL",
           "data": this.multipleSelection
        };
        addrealtraded(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.handle_realtraded()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
    },
    // 刷新
    RefreshCurrent_traded(){
      this.handle_realtraded()
    },
    // 调整
    tz_traded(){
        if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.tztradeddialogVisible = true;
         this.tz_tradedData = []
         console.log(1,this.multipleSelection)
          var data = this.multipleSelection;
          for (var i = 0; i <= data.length; i++) {
            this.tz_tradedData[0] = {
              "realaccountcode":data[0].realaccountcode,
              "brokerid":data[0].brokerid,                             
              "tradingday":data[0].tradingday,
              "tradedate":data[0].tradedate,
              "tradetime":data[0].tradetime,
              "instrumentid":data[0].instrumentid,
              "direction":data[0].direction,
              "commission":data[0].commission,
              "offsetflag":data[0].offsetflag,
              "volume":data[0].volume,
              "price":data[0].price,
              "hedgeflag":data[0].hedgeflag,
              "close_profit":data[0].close_profit,
              "tradeid":data[0].tradeid
            };
          }
          var list = {};
        this.tz_tradedData.push(list)
      }
    },
    // 调整保存
    change_tztraded(ruleForm2){
       let params = {
           "operation":"ADJUST",
            data:this.tz_tradedData
        };
            const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm2].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealtraded(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.tztradeddialogVisible = false
                 this.handle_realtraded()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
   
    // // // // // // // // // // // // // // // // // // // // // // // // // // // // 持仓
     // 每页数
    handleSizeChange3(val) {
      this.posForm.pageSize = val;
      this.posForm.page = 1;
      this.futures_getData1();
    },
    // 当前页
    handleCurrentChange3(val) {
      this.posForm.page = val;
      this.futures_getData1();
    },
    futures_getData(){
      this.posForm.page = 1;
      this.futures_getData1()
    },
     //  持仓明细接口
    futures_getData1(){
       conrealpos(this.posForm).then(res => {
            // if (res.errcode == "1") {
               this.postableData = []
               var data = res.result.results
               this.posForm.totalPage = res.result.count;
                for (var i = 0; i <= data.length; i++) {
                  this.postableData[i] = {
                   tradeid: data[i].TradeID,
                   adjust_status: data[i].adjust_status,
                   exchangeid: data[i].ExchangeID,
                   exchangename: data[i].ExchangeName,
                   realaccountcode: data[i].RealAccountCode,
                   realaccountname: data[i].RealAccountName,
                   brokerid: data[i].BrokerID,
                   tradingday: data[i].TradingDay,
                   productname: data[i].ProductName,
                   instrumentid: data[i].InstrumentID,
                   opendate: data[i].OpenDate,
                   direction: data[i].Direction,
                   directionname: data[i].DirectionName,
                   hedgeflag: data[i].HedgeFlag,
                   hedgeflagname: data[i].HedgeFlagName,
                   volume: data[i].Volume,
                   openprice: data[i].OpenPrice,
                   lastsettlementprice: data[i].LastSettlementPrice,
                   settlementprice: data[i].SettlementPrice,
                   float_profit_loss: data[i].float_profit_loss,
                   mark_profit_loss: data[i].mark_profit_loss,
                   margin: data[i].Margin
                  }
              }
            }).catch(err =>{
          this.$message.error(err.msg);
        });
    },
    // 新增
    add_pos(){
       this.posdialogVisible = true;
    },
    // 新增保存
    change_addpos(ruleForm3){
       let params = {
           "operation":"ADD",
            data:this.add_posData
        };
          const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm3].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.posdialogVisible = false
                 this.futures_getData()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
    // 修改
    edit_pos(){
        if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.editposdialogVisible = true
         this.edit_posData = this.multipleSelection
      }
    },
    // 修改保存
    change_editpos(ruleForm3){
      let params = {
           "operation":"MOD",
            data:{
              "realaccountcode":this.edit_posData[0].realaccountcode,
               "brokerid":this.edit_posData[0].brokerid,                             
               "tradingday":this.edit_posData[0].tradingday,
               "instrumentid":this.edit_posData[0].instrumentid,
               "opendate":this.edit_posData[0].opendate,
               "tradeid":this.edit_posData[0].tradeid,
               "direction":this.edit_posData[0].direction,
               "volume":this.edit_posData[0].volume,
               "openprice":this.edit_posData[0].openprice,
               "hedgeflag":this.edit_posData[0].hedgeflag,
               "margin":this.edit_posData[0].margin
             }
        };
            const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm3].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.editposdialogVisible = false
                 this.futures_getData()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
      // 复制
    copy_pos(){
       if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.copyposdialogVisible = true;
          // this.copy_posData = this.multipleSelection
         this.copy_posData = this.multipleSelection
//           console.log(1,this.multipleSelection)
//           var data = this.multipleSelection;
//           for (var i = 0; i <= data.length; i++) {
//             this.copy_posData[0] = {
//               "realaccountcode":data[0].realaccountcode,
//               "brokerid":data[0].brokerid,                             
//               "tradingday":data[0].tradingday,
//               "instrumentid":data[0].instrumentid,
//               "opendate":data[0].opendate,
//               "tradeid":data[0].tradeid,
//               "direction":data[0].direction,
//               "volume":data[0].volume,
//               "openprice":data[0].openprice,
//               "hedgeflag":data[0].hedgeflag,
//               "margin":data[0].margin,
//             };
//           }
         
      }
      
    },
    // 复制保存
     change_copypos(ruleForm3){
       let params = {
           "operation":"ADD",
            data:this.copy_posData
        };
             const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm3].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.copyposdialogVisible = false
                 this.futures_getData()
            }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
    // 删除
    del_pos(){
       this.$confirm('是否删除该持仓明细信息?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let params = {
           "operation":"DEL",
           "data": this.multipleSelection
        };
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.futures_getData()
          }).catch(err =>{
          this.$message.error(err.msg);
        });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
    },
    // 刷新
    RefreshCurrent_pos(){
      this.futures_getData()
    },
    // 调整
    tz_pos(){
        if (this.multipleSelection == undefined) {
          this.openMessage();
      } else if(this.multipleSelection.length != 1){
         this.$message.error("修改只能选中一条数据进行！");
      } else {
         this.tzposdialogVisible = true;
         this.tz_posData = []
         console.log(1,this.multipleSelection)
          var data = this.multipleSelection;
          for (var i = 0; i <= data.length; i++) {
            this.tz_posData[0] = {
              "realaccountcode":data[0].realaccountcode,
              "brokerid":data[0].brokerid,                             
              "tradingday":data[0].tradingday,
              "instrumentid":data[0].instrumentid,
              "opendate":data[0].opendate,
              "tradeid":data[0].tradeid,
              "direction":data[0].direction,
              "volume":data[0].volume,
              "openprice":data[0].openprice,
              "hedgeflag":data[0].hedgeflag,
              "margin":data[0].margin,
            };
          }
        var list = {};
        this.tz_posData.push(list)
      }
    },
    // 调整保存
    change_tzpos(ruleForm3){
       let params = {
           "operation":"ADJUST",
            data:this.tz_posData
        };
      const rule1 = new Promise((resolve, reject) => {
        this.$refs[ruleForm3].validate(valid => {
          if (valid) {
            resolve();
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      });
       Promise.all([rule1]).then(() => {
        addrealpos(params).then(res => {
            // if (res.errcode == "1") {
                this.$message.success(res.result);
                 this.tzposdialogVisible = false
                 this.futures_getData()
           }).catch(err =>{
          this.$message.error(err.msg);
        });
         });
    },
    

     // 行内编辑
    handleCellDataChange({ rowIndex, key, value, row }) {
      console.log(rowIndex);
      console.log(key);
      console.log(value);
      console.log(row);
    },
    // 多选
    handleSelectionChange(val) {
       this.multipleSelection = val;
       console.log('多选',this.multipleSelection)
     },
      // 获取表格选中时的数据
      selectRow (val) {
        this.selectlistRow = val
      },
      // 增加行
      addRow1 () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.add_capData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData1() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.add_capData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.add_capData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
       // 增加行
      addRow1_copy () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.copy_capData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData1_copy() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.copy_capData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.copy_capData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
       // 增加行
      addRow2 () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.add_tradedData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData2() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.add_tradedData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.add_tradedData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
       // 增加行
      addRow2_copy () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.copy_tradedData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData2_copy() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.copy_tradedData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.copy_tradedData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
        // 增加行
      addRow3 () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.add_posData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData3() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.add_posData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.add_posData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
       // 增加行
      addRow3_copy () {
       	  var list = {
          rowNum:this.rowNum,
          "realaccountcode":"",
            "brokerid":"",                             
            "tradingday":"",
            "prebalance":"",
            "deposit_withdraw":"",
            "closeprofit":"",
            "positionprofit":"",
            "commission":"",  
            "balance":"",   
            "currmargin":"", 
            "deliverymargin":"", 
            "available":"", 
            "exercise_fee":""
   		 };
        this.copy_posData.unshift(list)
        this.rowNum += 1;
      },
      // 删除方法
      // 删除选中行
      delData3_copy() {
        for (let i = 0; i < this.selectlistRow.length; i++) {
          let val = this.selectlistRow
          val.forEach((val, index) => {
            this.copy_posData.forEach((v, i) => {
              if (val.rowNum === v.rowNum) {
                // i 为选中的索引
                this.copy_posData.splice(i, 1)
              }
            })
          })
        }
        // 删除完数据之后清除勾选框
        this.$refs.table.clearSelection()
      },
  },
  mounted(){
    // this.handle_instrument();
    this.handle_realaccouncap();
    this.handle_realtraded();
    this.futures_getData();
  }
}
</script>